import { build, defineConfig } from 'vite'

// import importToCDN, { autoComplete } from 'vite-plugin-cdn-import'


import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { AntDesignVueResolver, ElementPlusResolver } from 'unplugin-vue-components/resolvers'

import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),


    // AutoImport({
    //   resolvers: [ElementPlusResolver()],
    // }),

    Components({
      resolvers: [
        AntDesignVueResolver(),
        ElementPlusResolver()
      ],
    }),
    

    // importToCDN({
    //   modules: [
    //     {
    //       name: "vue",
    //       var: "Vue",
    //       path: "https://unpkg.com/vue@next",
    //     },
    //     {
    //       name: "element-plus",
    //       var: "ElementPlus",
    //       path: `https://unpkg.com/element-plus`,
    //       css: "https://unpkg.com/element-plus/dist/index.css",
    //     },
    //   ],
    // }),

  ],
  
  base: './',
  server: {
    proxy: {
      '/api': {
        target: 'https://apis.netstart.cn/xpc/',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    }
  },

  resolve: {
    //别名替代
    alias: {
      '@': __dirname + '/src',

    }
  },



})
